<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <title>z2-y3-k4</title>
  <script src="https://webapi.amap.com/maps?v=2.0&key=838a3d21d4847438dbbd68745b9166e4">
  </script>
</head>

<body>
  <div id="app"></div>
  <!-- built files will be auto injected -->
</body>

<script>
  var a = 5;
  (() => {
    function setRem() {
      var uWidth = 375; // 设计稿的宽度
      // 获取屏幕的宽度
      var clientWidth = document.documentElement.clientWidth;
      document.documentElement.style.fontSize =
        (clientWidth / uWidth) * 10 + 'px';
      if (clientWidth >= 500) {
        document.documentElement.style.fontSize =
          (500 / uWidth) * 10 + 'px';
      } else {
        document.documentElement.style.fontSize =
          (clientWidth / uWidth) * 10 + 'px';
      }
    }
    setRem();
    let timer;
    window.onresize = () => {
      clearTimeout(timer);
      timer = setTimeout(() => {
        setRem();
      }, 300);
    };
  })();
</script>

</html>